/*
package com.taiyuan.zfmvp.kafka.consumer;

import com.alibaba.fastjson.JSONObject;
import com.taiyuan.zfmvp.sharding.dao.TestCodeMapper;
import com.taiyuan.zfmvp.sharding.model.TestCode;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

*/
/**
 * @param request
 * @Author: zhoufang@si-tech.com.cn
 * @Descriiption:
 * @Date 2022/2/14
 * @return
 *//*

@Component
public class ConsumerTest {

    @Resource
    private TestCodeMapper testCodeMapper;

    @KafkaListener(topics = "kafkatest")
    public void listen (ConsumerRecord<?, ?> record) throws Exception {
        System.out.printf("topic = %s, offset = %d, value = %s \n", record.topic(), record.offset(), record.value());
        TestCode testCode = new TestCode();
        String jsonStr = record.value().toString();
        Map<String, Object> jsonMap =  JSONObject.parseObject(jsonStr);
        testCode.setCouponCode(jsonMap.get("couponCode") + "");
        testCode.setPhoneNo(jsonMap.get("phoneNo") + "");
        testCodeMapper.insertSelective(testCode);
    }
}
*/
